﻿@page "/HYJ_MasterDetail_Modal"
@using BBCore.Core.Models.Samples
@using BBCore.Server.PublicComponentBase
@using BBCore.Core.Models.EnumTypes
@using BBCore.Application.Interface
@inject DialogService DialogService
@inject IDispatchService<string> DispatchService
@inject IJSRuntime JSRuntime
@inject IClosedxmlExcelExportService ClosedxmlExcelExportService
@inherits Master_Detail_ComponentBase
@inject IDataQueryService<HYJ_Master_Table> IMasterDataQueryService
<Table TItem="HYJ_Master_Table" @ref="_mastertable"
       IsBordered="true" IsStriped="true" IsPagination="true" PageItemsSource="new int[] { 5,10,20}"
       ShowEmpty="true" EmptyText="暂无数据" EmptyImage="images/empty.svg" ClickToSelect="true"
       ShowSkeleton="true" ShowLoading="true" ShowSearch="true" ShowRefresh="false"
       ShowAddButton="false"
       ShowEditButton="false"
       ShowDeleteButton="false"
       ShowExtendEditButton="false"
       ShowExtendDeleteButton="@AuthorizeButton(ButtonPermissionTypeEnum.Del)"
       OnQueryAsync="@OnMasterQueryAsync" OnDeleteAsync="OnDeleteAsync"
       ShowToolbar="true" ShowExtendButtons="true" ShowDefaultButtons="true"
       ShowExportButton="true">
    <TableColumns>
        <TableColumn @bind-Field="@context.JOB_NO" Searchable="true"></TableColumn>
        <TableColumn @bind-Field="@context.QUANTITY"></TableColumn>
        <TableColumn @bind-Field="@context.REQ_DATE"></TableColumn>
    </TableColumns>
    <TableToolbarTemplate>
        <Button Text="新增主从记录" OnClick="AddRecord" IsDisabled="@(!AuthorizeButton(ButtonPermissionTypeEnum.Add))"></Button>
        <Button Text="导出全部数据" OnClick="exportdata"></Button>
    </TableToolbarTemplate>
    <BeforeRowButtonTemplate>
        <TableCellButton Color="Color.Info" Text="编辑主从记录" IsDisabled="@(!AuthorizeButton(ButtonPermissionTypeEnum.Edit))" OnClick="()=>EditRecord(context)" />
    </BeforeRowButtonTemplate>
</Table>

